package com.fimuz.mqmeet.api.loginusersetting.control;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.fimuz.mqmeet.api.loginusersetting.service.LoginusersettingService;
import com.fimuz.mqmeet.api.loginusersetting.service.model.GetSpModel;
import com.fimuz.mqmeet.api.loginusersetting.service.model.GetSrModel;
import com.fimuz.mqmeet.api.loginusersetting.service.model.UpdateBuildIdAndRetionIdSpModel;
import com.fimuz.mqmeet.api.loginusersetting.service.model.UpdateBuildIdAndRetionIdSrModel;
import com.fosun.spr.core.base.CoBaseControl;
import com.fosun.spr.core.utils.SessionUtils;

@Controller
public class LoginusersettingControl extends CoBaseControl {
	//@Autowired
	@Resource
	private LoginusersettingService loginusersettingService;

	/**
	 * http://127.0.0.1:8080/mq_meet_server/api/loginusersetting/get
	 * 
	 * @param request
	 * @param spModel
	 * @return
	 */	
	@RequestMapping(value = "/api/loginusersetting/get",method = RequestMethod.GET)
	public GetSrModel get(HttpServletRequest request, GetSpModel spModel) {
		SessionUtils.fillSpModel(request, spModel);
		GetSrModel srModel = loginusersettingService.get(spModel);
		return srModel;
	}
	/**
	 * http://127.0.0.1:8080/mq_meet_server/api/loginusersetting/updateBuildIdAndRetionId
{
	"buildingId":"",
	"regionId":""
}


	 * @param request
	 * @param spModel
	 * @return
	 */	
	@RequestMapping(value = "/api/loginusersetting/updateBuildIdAndRetionId",method = RequestMethod.POST)
	public UpdateBuildIdAndRetionIdSrModel updateBuildIdAndRetionId(HttpServletRequest request,@RequestBody UpdateBuildIdAndRetionIdSpModel spModel) {
		SessionUtils.fillSpModel(request, spModel);
		UpdateBuildIdAndRetionIdSrModel srModel = loginusersettingService.updateBuildIdAndRetionId(spModel);
		return srModel;
	}
	
	
	//生成成json的代码
	public static void main(String[] args) throws Exception{
		debugPrintJsonSpModel(new UpdateBuildIdAndRetionIdSpModel());
	}	
}
